package com.itheima.demo.controller;

import com.itheima.demo.pojo.User;
import com.itheima.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("hello")
public class HelloController {

    @Autowired
    private UserService userService;

    @GetMapping("user/{id}")
    @ResponseBody
    public User queryUser(@PathVariable("id")Long id){
        return this.userService.queryUser(id);
    }
}
